import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import * as dayjs from 'dayjs';
@Entity('token')
export class Token {
  @PrimaryGeneratedColumn('uuid')
  id: number;

  @Column()
  type: string;

  @Column()
  token: string;

  @Column()
  time: string;

  @Column({
    select: false,
    transformer: {
      to: (value) => value,
      from: (value) => dayjs(value).format('YYYY-MM-DD HH:mm:ss'),
    },
  })
  createdAt: Date;

  @Column({
    transformer: {
      to: (value) => value,
      from: (value) => dayjs(value).format('YYYY-MM-DD HH:mm:ss'),
    },
  })
  updatedAt: Date;
}
